home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / kernel / vm / vm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-19  |  19.5 KB  |  549 lines

  1. /*
  2.  * vm.h --
  3.  *
  4.  *     Virtual memory data structures and procedure headers exported by
  5.  *     the virtual memory module.
  6.  *
  7.  * Copyright 1986 Regents of the University of California
  8.  * All rights reserved.
  9.  *
  10.  *
  11.  * $Header: /cdrom/src/kernel/Cvsroot/kernel/vm/vm.h,v 9.15 92/07/22 16:55:11 jhh Exp $ SPRITE (Berkeley)
  12.  */
  13.  
  14.  
  15. #ifndef _VM
  16. #define _VM
  17.  
  18. #include <list.h>
  19.  
  20. #ifdef KERNEL
  21. #include <user/vm.h>
  22. #if 0
  23. #include <vmMach.h>
  24. #endif
  25. #include <vmStat.h>
  26. #include <fs.h>
  27. #include <sync.h>
  28. #include <proc.h>
  29. #include <procMigrate.h>
  30. #include <sprite.h>
  31. #else
  32. #if 0
  33. #include <kernel/vmMach.h>
  34. #endif
  35. #include <vmStat.h>
  36. #include <kernel/fs.h>
  37. #include <kernel/sync.h>
  38. #include <kernel/proc.h>
  39. #include <kernel/procMigrate.h>
  40. #include <sprite.h>
  41. #endif
  42.  
  43. /*
  44.  * Structure to represent a translated virtual address
  45.  */
  46. typedef struct Vm_VirtAddr {
  47.     struct Vm_Segment    *segPtr;    /* Segment that address falls into.*/
  48.     int         page;        /* Virtual page. */
  49.     int         offset;        /* Offset in the page. */
  50.     int            flags;        /* Flags defined below */
  51.     struct Vm_SegProcList    *sharedPtr;    /* Pointer to shared seg. */
  52. } Vm_VirtAddr;
  53.  
  54. /*
  55.  * Values for flags field.  Lower 8 bits are for our use, next 8 bits are 
  56.  * machine dependent.
  57.  *
  58.  *    VM_HEAP_PT_IN_USE    The heap segment for the current process had
  59.  *                its page table marked as being in use.
  60.  *    VM_READONLY_SEG        The segment is read only for this process.
  61.  */
  62. #define    VM_HEAP_PT_IN_USE    0x1
  63. #define VM_READONLY_SEG        0x2
  64. /*
  65.  * A page table entry.
  66.  */
  67. typedef unsigned int    Vm_PTE;
  68.  
  69. /*
  70.  * Flags to set and extract the fields of the PTE.
  71.  *
  72.  *    VM_VIRT_RES_BIT        The page is resident in the segment's virtual
  73.  *                address space.
  74.  *    VM_PHYS_RES_BIT        The page is physically resident in memory.
  75.  *      VM_ZERO_FILL_BIT    The page should be filled on demand with zeros.
  76.  *    VM_ON_SWAP_BIT        The page is on swap space.
  77.  *    VM_IN_PROGRESS_BIT    A page fault is occuring on this page.
  78.  *    VM_COR_BIT        The page is copy-on-reference.
  79.  *    VM_COW_BIT        The page is copy-on-write.
  80.  *    VM_REFERENCED_BIT    The page has been referenced.
  81.  *    VM_MODIFIED_BIT        The page has been modified.
  82.  *      VM_READ_ONLY_PROT    The page is read-only.
  83.  *    VM_COR_CHECK_BIT    The page is marked read-only after a cor fault
  84.  *                to determine if the page will in fact get
  85.  *                modified.
  86.  *    VM_PAGE_FRAME_FIELD    The virtual page frame that this page is 
  87.  *                resident in.
  88.  */
  89. #define    VM_VIRT_RES_BIT        0x80000000
  90. #define VM_PHYS_RES_BIT        0x40000000
  91. #define VM_ZERO_FILL_BIT    0x20000000
  92. #define VM_ON_SWAP_BIT        0x10000000
  93. #define VM_IN_PROGRESS_BIT    0x08000000
  94. #define VM_COR_BIT        0x04000000
  95. #define VM_COW_BIT        0x02000000
  96. #define VM_REFERENCED_BIT    0x01000000
  97. #define VM_MODIFIED_BIT        0x00800000
  98. #define VM_READ_ONLY_PROT    0x00400000
  99. #define VM_COR_CHECK_BIT    0x00200000
  100. #define VM_PREFETCH_BIT        0x00100000
  101. #define VM_PAGE_FRAME_FIELD    0x000fffff
  102.  
  103. /*
  104.  * Macro to get a page frame out of a PTE.
  105.  */
  106. #define Vm_GetPageFrame(pte) ((unsigned int) ((pte) & VM_PAGE_FRAME_FIELD))
  107.  
  108. /*
  109.  * The page size.
  110.  */
  111. extern    int    vm_PageSize;
  112.  
  113. /*
  114.  * The end of allocated kernel+data memory.
  115.  */
  116. extern    Address    vmMemEnd;
  117.  
  118. /*
  119.  * The end of allocated kernel+data after the boot. On the DecStations
  120.  * vmMemEnd gets boosted to the start of virtual memory, leaving a hole.
  121.  */
  122. extern    Address vmBootEnd;
  123.  
  124. /*
  125.  * The type of accessibility desired when making a piece of data user
  126.  * accessible.  VM_READONLY_ACCESS means that the data will only be read and
  127.  * will not be written.  VM_OVERWRITE_ACCESS means that the entire block of
  128.  * data will be overwritten.  VM_READWRITE_ACCESS means that the data 
  129.  * will both be read and written.
  130.  */
  131. #define    VM_READONLY_ACCESS        1
  132. #define    VM_OVERWRITE_ACCESS        2
  133. #define    VM_READWRITE_ACCESS        3
  134.  
  135. /*
  136.  * Structure that contains relevant info from the aout header to allow
  137.  * reuse of sticky segments.
  138.  */
  139. typedef struct {
  140.     int    heapPages;
  141.     int    heapPageOffset;
  142.     int    heapFileOffset;
  143.     int    bssFirstPage;
  144.     int    bssLastPage;
  145.     int    entry;
  146.     int flags;
  147.     int heapExcess;
  148. } Vm_ExecInfo;
  149.  
  150. /*
  151.  * The segment table structure.  Details about the segment table and
  152.  * some of the fields in here are defined in vmInt.h.
  153.  *
  154.  * NOTE: Process migration requires that the five fields offset, fileAddr,
  155.  *       type, numPages and ptSize be contiguous.
  156.  */
  157. typedef struct Vm_Segment {
  158.     List_Links        links;        /* Links used to put the segment
  159.                      * table entry in list of free segments,
  160.                      * list of inactive segments or list
  161.                      * of copy-on-write segments. */
  162.     int            segNum;        /* The number of this segment. */
  163.     int         refCount;    /* Number of processes using this 
  164.                      * segment */
  165.     Sync_Condition    condition;    /* Condition to wait on for this
  166.                      * segment. */
  167.     Fs_Stream        *filePtr;    /* Pointer to the file that pages are
  168.                      * being demanded loaded from. */
  169.                         /* Name of object file for code 
  170.                      * segments. */
  171.     char        objFileName[VM_OBJ_FILE_NAME_LENGTH];
  172.     Fs_Stream        *swapFilePtr;    /* Structure for an opened swap file.*/
  173.     char        *swapFileName;  /* The filename associated with the
  174.                      * swap file. */
  175.     int            offset;        /* Explained in vmInt.h. */
  176.     int            fileAddr;    /* The address in the object file where
  177.                      * data or code for this segment 
  178.                      * begins. */
  179.     int               type;        /* CODE, STACK, HEAP, or SYSTEM */
  180.     int            numPages;    /* Explained in vmInt.h. */
  181.     int            ptSize;        /* Number of pages in the page table */
  182.     int            resPages;    /* Number of pages in physical memory
  183.                      * for this segment. */
  184.     Vm_PTE        *ptPtr;        /* Pointer to the page table for this 
  185.                      * segment */
  186.     struct VmMach_SegData *machPtr;    /* Pointer to machine dependent data */
  187.     int            flags;        /* Flags to give information about the
  188.                      * segment table entry. */
  189.     List_Links        procListHdr;    /* Header node for list of processes
  190.                      * sharing this segment. */
  191.     List_Links        *procList;    /* Pointer to list of processes 
  192.                      * sharing this segment. */
  193.     int            ptUserCount;    /* The number of current users of this
  194.                      * page table. */
  195.     ClientData        fileHandle;    /* Handle for object file. */
  196.     Vm_ExecInfo        execInfo;    /* Information to allow reuse of 
  197.                      * sticky segments. */
  198.     struct VmCOWInfo    *cowInfoPtr;    /* Pointer to copy-on-write list 
  199.                      * header. */
  200.     int            numCOWPages;    /* Number of copy-on-write pages that
  201.                      * this segment references. */
  202.     int            numCORPages;    /* Number of copy-on-ref pages that
  203.                      * this segment references. */
  204.     Address        minAddr;    /* Minimum address that the segment
  205.                      * can ever have. */
  206.     Address        maxAddr;    /* Maximium address that the segment
  207.                      * can ever have. */
  208.     int            dummy;
  209. } Vm_Segment;
  210.  
  211. /*
  212.  * Pointer to the system segment.
  213.  */
  214. extern     Vm_Segment    *vm_SysSegPtr;
  215.  
  216. /*
  217.  * Information stored by each process.
  218.  */
  219. typedef struct Vm_ProcInfo {
  220.     Vm_Segment            *segPtrArray[VM_NUM_SEGMENTS];
  221.     int                numMakeAcc;    /* Nesting level of make
  222.                          * make accessibles for this
  223.                          * process. */
  224.     struct VmMach_ProcData    *machPtr;    /* Pointer to machine dependent
  225.                          * data. */
  226.     int                vmFlags;    /* Flags defined below. */
  227.     List_Links            *sharedSegs;    /* Process's shared segs. */
  228.     Address            sharedStart;    /* Start of shared region.  */
  229.     Address            sharedEnd;    /* End of shared region.  */
  230. } Vm_ProcInfo;
  231.  
  232. /*
  233.  * List of the shared segments.
  234.  * There is one of these entries for each shared segment.
  235.  */
  236. typedef struct Vm_SharedSegTable {
  237.     List_Links          segList;        /* Links of shared segments. */
  238.     int                 serverID;       /* Server of associated file. */
  239.     int                 domain;         /* Domain of associated file. */
  240.     int                 fileNumber;     /* File number of associated file. */
  241.     struct Vm_Segment   *segPtr;        /* Shared segment. */
  242.     int                 refCount;       /* Number of references to segment.
  243. */
  244. } Vm_SharedSegTable;
  245.  
  246. /*
  247.  * Shared segments associated with a process.
  248.  * There is one of these entries for each processor-segment mapping.
  249.  */
  250. typedef struct Vm_SegProcList {
  251.     List_Links          segList;        /* Links of shared segments. */
  252.     int                 fd;             /* File descriptor of the mapping. */
  253.     Vm_SharedSegTable   *segTabPtr;     /* Pointer to shared segment table. */
  254.     Address             addr;           /* Start address of segment. */
  255.     int            offset;        /* Page table offset (see vmInt.h). */
  256.     int            fileAddr;    /* Offset into the file. */
  257.     Address             mappedStart;    /* Start of mapped part. */
  258.     Address             mappedEnd;      /* End of mapped part. */
  259.     Fs_Stream           *stream;        /* Stream of mapping. */
  260.     int                 prot;           /* Protections of segment. */
  261. } Vm_SegProcList;
  262.  
  263. /*
  264.  * Values for the vmFlags field.
  265.  *
  266.  * VM_COPY_IN_PROGRESS          Data is being copied from/to this process
  267.  *                              to/from the kernel's VAS.
  268.  */
  269. #define VM_COPY_IN_PROGRESS             0x01
  270.  
  271. /*
  272.  * Maximum number of pages that a user process can wire down with the
  273.  * Vm_PinUserMem call.
  274.  */
  275. #define    VM_MAX_USER_MAP_PAGES    4
  276.  
  277. /*
  278.  * Copy-on-write level.
  279.  */
  280. extern    Boolean    vm_CanCOW;
  281.  
  282. /*
  283.  * Maximum number of pageout processes.  This information is needed in
  284.  * order to configure the correct number of Proc_ServerProcs
  285.  */
  286. #define VM_MAX_PAGE_OUT_PROCS    3
  287.  
  288. /*
  289.  * The initialization procedures.
  290.  */
  291. extern void Vm_BootInit _ARGS_((void));
  292. extern void Vm_Init _ARGS_((void));
  293.  
  294. /*
  295.  * Procedure for segments
  296.  */
  297. extern void Vm_SegmentIncRef _ARGS_((Vm_Segment *segPtr, Proc_ControlBlock *procPtr));
  298. extern Vm_Segment *Vm_FindCode _ARGS_((Fs_Stream *filePtr, Proc_ControlBlock *procPtr, Vm_ExecInfo **execInfoPtrPtr, Boolean *usedFilePtr));
  299. extern void Vm_InitCode _ARGS_((Fs_Stream *filePtr, register Vm_Segment *segPtr, Vm_ExecInfo *execInfoPtr));
  300. extern void Vm_FlushCode _ARGS_((Proc_ControlBlock *procPtr, Address addr, int numBytes));
  301. extern Vm_Segment *Vm_SegmentNew _ARGS_((int type, Fs_Stream *filePtr, int fileAddr, int numPages, int offset, Proc_ControlBlock *procPtr));
  302. extern ReturnStatus Vm_SegmentDup _ARGS_((register Vm_Segment *srcSegPtr, Proc_ControlBlock *procPtr, Vm_Segment **destSegPtrPtr));
  303. extern void Vm_SegmentDelete _ARGS_((register Vm_Segment *segPtr, Proc_ControlBlock *procPtr));
  304. extern void Vm_ChangeCodeProt _ARGS_((Proc_ControlBlock *procPtr, Address startAddr, int numBytes, Boolean makeWriteable));
  305. extern ReturnStatus Vm_DeleteFromSeg _ARGS_((Vm_Segment *segPtr, int firstPage, int lastPage));
  306.  
  307. /*
  308.  * Procedures for pages.
  309.  */
  310. extern ReturnStatus Vm_PageIn _ARGS_((Address virtAddr, Boolean protFault));
  311. extern void Vm_Clock _ARGS_((ClientData data, Proc_CallInfo *callInfoPtr));
  312. extern int Vm_GetPageSize _ARGS_((void));
  313. extern ReturnStatus Vm_TouchPages _ARGS_ ((int firstPage, int numPages));
  314. ENTRY int Vm_GetRefTime _ARGS_ ((void));
  315.  
  316. /*
  317.  * Procedures for page tables.
  318.  */
  319. extern void Vm_ValidatePages _ARGS_((Vm_Segment *segPtr, int firstPage, int lastPage, Boolean zeroFill, Boolean clobber));
  320.  
  321. /*
  322.  * Procedure to allocate bytes of memory
  323.  */
  324. extern Address Vm_BootAlloc _ARGS_((int numBytes));
  325. extern Address Vm_RawAlloc _ARGS_((int numBytes));
  326.  
  327. /*
  328.  * Procedures for process migration.
  329.  */
  330. extern ReturnStatus Vm_InitiateMigration _ARGS_((Proc_ControlBlock *procPtr, int hostID, Proc_EncapInfo *infoPtr));
  331. extern ReturnStatus Vm_EncapState _ARGS_((register Proc_ControlBlock *procPtr, int hostID, Proc_EncapInfo *infoPtr, Address bufferPtr));
  332. extern ReturnStatus Vm_DeencapState _ARGS_((register Proc_ControlBlock *procPtr, Proc_EncapInfo *infoPtr, Address buffer));
  333. extern ReturnStatus Vm_FinishMigration _ARGS_((register Proc_ControlBlock *procPtr, int hostID, Proc_EncapInfo *infoPtr, Address bufferPtr, int failure));
  334. extern ReturnStatus Vm_EncapSegInfo _ARGS_((int segNum,
  335.     Vm_SegmentInfo *infoPtr));
  336.  
  337. /*
  338.  * Procedure for the file system.
  339.  */
  340. extern int Vm_MapBlock _ARGS_((Address addr));
  341. extern int Vm_UnmapBlock _ARGS_((Address addr, Boolean retOnePage, unsigned int *pageNumPtr));
  342. extern void Vm_FileChanged _ARGS_((Vm_Segment **segPtrPtr));
  343. extern void Vm_FsCacheSize _ARGS_((Address *startAddrPtr, Address *endAddrPtr));
  344.  
  345. /*
  346.  * System calls.
  347.  */
  348. extern ReturnStatus Vm_PageSize _ARGS_((int *pageSizePtr));
  349. extern ReturnStatus Vm_CreateVA _ARGS_((Address address, int size));
  350. extern ReturnStatus Vm_DestroyVA _ARGS_((Address address, int size));
  351. extern ReturnStatus Vm_Cmd _ARGS_((int command, int arg));
  352. extern ReturnStatus Vm_GetSegInfo _ARGS_((Proc_PCBInfo *infoPtr,
  353.     Vm_SegmentID segID, int infoSize, Address segBufPtr));
  354.  
  355. /*
  356.  * Procedures to get to user addresses.
  357.  */
  358. extern ReturnStatus Vm_CopyIn _ARGS_((register int numBytes,
  359.     Address sourcePtr, Address destPtr));
  360. extern ReturnStatus Vm_CopyOut _ARGS_((register int numBytes,
  361.     Address sourcePtr, Address destPtr));
  362. extern ReturnStatus Vm_CopyInProc _ARGS_((int numBytes,
  363.     register Proc_ControlBlock *fromProcPtr, Address fromAddr,
  364.     Address toAddr, Boolean toKernel));
  365. extern ReturnStatus Vm_CopyOutProc _ARGS_((int numBytes, Address fromAddr,
  366.     Boolean fromKernel, register Proc_ControlBlock *toProcPtr,
  367.     Address toAddr));
  368. extern ReturnStatus Vm_StringNCopy _ARGS_((int numBytes,
  369.     Address sourcePtr, Address destPtr, int *bytesCopiedPtr));
  370. extern void Vm_MakeAccessible _ARGS_((int accessType, int numBytes,
  371.     Address startAddr, register int *retBytesPtr,
  372.     register Address *retAddrPtr));
  373. extern void Vm_MakeUnaccessible _ARGS_((Address addr, int numBytes));
  374.  
  375. /* 
  376.  * Procedures for recovery.
  377.  */
  378. extern void Vm_OpenSwapDirectory _ARGS_((ClientData data,
  379.     Proc_CallInfo *callInfoPtr));
  380. extern void Vm_Recovery _ARGS_((void));
  381.  
  382. /*
  383.  * Miscellaneous procedures.
  384.  */
  385. extern Address Vm_GetKernelStack _ARGS_((int invalidPage));
  386. extern void Vm_FreeKernelStack _ARGS_((Address stackBase));
  387. extern void Vm_ProcInit _ARGS_((Proc_ControlBlock *procPtr));
  388. extern ReturnStatus Vm_PinUserMem _ARGS_((int mapType, int numBytes,
  389.     register Address addr));
  390. extern void Vm_UnpinUserMem _ARGS_((int numBytes, Address addr));
  391. extern void Vm_ReservePage _ARGS_((unsigned int pfNum));
  392. extern Boolean VmMach_VirtAddrParse _ARGS_((Proc_ControlBlock *procPtr,
  393.     Address virtAddr, register Vm_VirtAddr *transVirtAddrPtr));
  394.  
  395. /*
  396.  * Routines to provide access to internal virtual memory stuff for the machine
  397.  * dependent code.
  398.  */
  399. extern unsigned int Vm_KernPageAllocate _ARGS_((void));
  400. extern void Vm_KernPageFree _ARGS_((unsigned int pfNum));
  401. extern unsigned int Vm_GetKernPageFrame _ARGS_((int pageFrame));
  402.  
  403. /*
  404.  * Shared memory routines.
  405.  */
  406. extern ReturnStatus Vm_Mmap _ARGS_((Address startAddr, int length, int prot,
  407.     int share, int streamID, int fileAddr, Address *mappedAddr));
  408. extern ReturnStatus Vm_Munmap _ARGS_((Address startAddr, int length,
  409.     int noError));
  410. extern ReturnStatus Vm_Msync _ARGS_((Address startAddr, int length));
  411. extern ReturnStatus Vm_Mlock _ARGS_((Address startAddr, int length));
  412. extern ReturnStatus Vm_Munlock _ARGS_((Address startAddr, int length));
  413. extern ReturnStatus Vm_Mincore _ARGS_((Address startAddr, int length,
  414.     char *retVec));
  415. extern ReturnStatus Vm_Mprotect _ARGS_((Address startAddr, int length,
  416.     int prot));
  417. extern void Vm_CleanupSharedFile _ARGS_((Proc_ControlBlock *procPtr,
  418.     Fs_Stream *streamPtr));
  419. extern void Vm_CleanupSharedProc _ARGS_((Proc_ControlBlock *procPtr));
  420. extern void Vm_DeleteSharedSegment _ARGS_((Proc_ControlBlock *procPtr,
  421.     Vm_SegProcList *segProcPtr));
  422. extern void Vm_CopySharedMem _ARGS_((Proc_ControlBlock *parentProcPtr,
  423.     Proc_ControlBlock *childProcPtr));
  424.  
  425. /*
  426.  * Machine-dependent routines exported to other modules.
  427.  */
  428. /*
  429.  * Device mapping.
  430.  */
  431. extern Address VmMach_DMAAlloc _ARGS_((int numBytes, Address srcAddr));
  432. extern void VmMach_DMAFree _ARGS_((int numBytes, Address mapAddr));
  433. extern ReturnStatus VmMach_MapKernelIntoUser _ARGS_((unsigned int
  434.         kernelVirtAddr, int numBytes, unsigned int userVirtAddr,
  435.         unsigned int *realVirtAddrPtr));
  436.  
  437. /*
  438.  * Routines to manage contexts.
  439.  */
  440. extern void VmMach_FreeContext _ARGS_((register Proc_ControlBlock *procPtr));
  441. extern void VmMach_ReinitContext _ARGS_((register Proc_ControlBlock *procPtr));
  442. extern ClientData VmMach_SetupContext _ARGS_((register Proc_ControlBlock
  443.         *procPtr));
  444.  
  445. /*
  446.  * Initialization
  447.  */
  448. extern void VmMach_BootInit _ARGS_((int *pageSizePtr, int *pageShiftPtr,
  449.         int *pageTableIncPtr, int *kernMemSizePtr, int *numKernPagesPtr,
  450.         int *maxSegsPtr, int *maxProcessesPtr));
  451. extern Address VmMach_AllocKernSpace _ARGS_((Address baseAddr));
  452. extern void VmMach_Init _ARGS_((int firstFreePage));
  453.  
  454. /*
  455.  * Segment creation, expansion, and destruction.
  456.  */
  457. extern void VmMach_SegInit _ARGS_((struct Vm_Segment *segPtr));
  458. extern void VmMach_SegExpand _ARGS_((register struct Vm_Segment *segPtr,
  459.         int firstPage, int lastPage));
  460. extern void VmMach_SegDelete _ARGS_((register struct Vm_Segment *segPtr));
  461.  
  462. /*
  463.  * Process initialization.
  464.  */
  465. extern void VmMach_ProcInit _ARGS_((register struct Vm_ProcInfo *vmPtr));
  466.  
  467. /*
  468.  * Manipulating protection.
  469.  */
  470. extern void VmMach_SetSegProt _ARGS_((register struct Vm_Segment *segPtr,
  471.         register int firstPage, int lastPage, Boolean makeWriteable));
  472. extern void VmMach_SetPageProt _ARGS_((register struct Vm_VirtAddr
  473.         *virtAddrPtr, Vm_PTE softPTE));
  474.  
  475. /*
  476.  * Reference and modify bits.
  477.  */
  478. extern void VmMach_GetRefModBits _ARGS_((register struct Vm_VirtAddr
  479.         *virtAddrPtr, unsigned int virtFrameNum, register Boolean *refPtr,
  480.         register Boolean *modPtr));
  481. extern void VmMach_ClearRefBit _ARGS_((register struct Vm_VirtAddr
  482.     *virtAddrPtr, unsigned int virtFrameNum));
  483. extern void VmMach_ClearModBit _ARGS_((register struct Vm_VirtAddr
  484.     *virtAddrPtr, unsigned int virtFrameNum));
  485. extern void VmMach_AllocCheck _ARGS_((register struct Vm_VirtAddr
  486.     *virtAddrPtr, unsigned int virtFrameNum, register Boolean *refPtr,
  487.         register Boolean *modPtr));
  488.  
  489. /*
  490.  * Page validation and invalidation.
  491.  */
  492. extern void VmMach_PageValidate _ARGS_((register struct Vm_VirtAddr
  493.     *virtAddrPtr, Vm_PTE pte));
  494. extern void VmMach_PageInvalidate _ARGS_((register struct Vm_VirtAddr
  495.     *virtAddrPtr, unsigned int virtPage, Boolean segDeletion));
  496.  
  497. /*
  498.  * Routine to parse a virtual address.
  499.  */
  500. extern Boolean VmMach_VirtAddrParse _ARGS_((Proc_ControlBlock *procPtr,
  501.         Address virtAddr, register struct Vm_VirtAddr *transVirtAddrPtr));
  502.  
  503. /*
  504.  * Routines to copy data to/from user space.
  505.  */
  506. extern ReturnStatus VmMach_CopyInProc _ARGS_((int numBytes,
  507.         Proc_ControlBlock *fromProcPtr, Address fromAddr,
  508.         struct Vm_VirtAddr *virtAddrPtr, Address toAddr, Boolean toKernel));
  509. extern ReturnStatus VmMach_CopyOutProc _ARGS_((int numBytes,
  510.         Address fromAddr, Boolean fromKernel, Proc_ControlBlock *toProcPtr,
  511.         Address toAddr, struct Vm_VirtAddr *virtAddrPtr));
  512.  
  513. /*
  514.  * Pinning and unpinning user memory pages.
  515.  */
  516. extern void VmMach_PinUserPages _ARGS_((int mapType, struct Vm_VirtAddr
  517.         *virtAddrPtr, int lastPage));
  518. extern void VmMach_UnpinUserPages _ARGS_((struct Vm_VirtAddr *virtAddrPtr,
  519.         int lastPage));
  520. /*
  521.  * Cache flushing.
  522.  */
  523. extern void VmMach_FlushPage _ARGS_((struct Vm_VirtAddr *virtAddrPtr,
  524.         Boolean invalidate));
  525. extern void VmMach_FlushCode _ARGS_((Proc_ControlBlock *procPtr,
  526.         struct Vm_VirtAddr *virtAddrPtr, unsigned virtPage, int numBytes));
  527. extern void VmMach_FlushByteRange _ARGS_((Address virtAddr, int numBytes));
  528. /*
  529.  * Migration.
  530.  */
  531. extern void VmMach_HandleSegMigration _ARGS_((struct Vm_Segment *segPtr));
  532.  
  533. extern ReturnStatus VmMach_Cmd _ARGS_((int command, int arg));
  534.  
  535. /*
  536.  * Shared memory.
  537.  */
  538. extern void VmMach_SharedSegFinish _ARGS_((Proc_ControlBlock *procPtr,
  539.         Address addr));
  540. extern void VmMach_SharedProcStart _ARGS_((Proc_ControlBlock *procPtr));
  541. extern void VmMach_SharedProcFinish _ARGS_((Proc_ControlBlock *procPtr));
  542. extern void VmMach_CopySharedMem _ARGS_((Proc_ControlBlock *parentProcPtr,
  543.         Proc_ControlBlock *childProcPtr));
  544. extern ReturnStatus VmMach_SharedStartAddr _ARGS_((Proc_ControlBlock *procPtr,
  545.         int size, Address *reqAddr, int fixed));
  546.  
  547.  
  548. #endif /* _VM */
  549.